#include<bits/stdc++.h>
using namespace std;
inline int read(){
	int x=0;bool f=0;char ch=getchar();
	while(ch<'0'||ch>'9')f^=(ch=='-'),ch=getchar();
	while('0'<=ch&&ch<='9')x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
	return f?-x:x;
}
const int Maxn=1e6+5;
int n;
vector<int>a[Maxn];
int vis[Maxn*2];
namespace sub1{
	int p[Maxn];
	inline void solve(){
		for(int i=1;i<=n;i++)p[i]=a[i][0];
		sort(p+1,p+1+n);
		int now=0;
		for(int i=1;i<=n;i++){
			now=max(now,p[i]);
			while(vis[now])now++;
			vis[now]=1;
		}
		int pp=1e6;
		while(!vis[pp])pp--;
		for(int i=pp;i;i--)printf("%d",vis[i]);
	}
}
int main(){
	freopen("mcmf.in","r",stdin);
	freopen("mcmf.out","w",stdout);
	n=read();int sub=1;
	for(int i=1;i<=n;i++){
		int k=read();sub&=(k==1);
		while(k--)a[i].push_back(read());
	}
	if(sub)sub1::solve(),exit(0);
	return 0;
}

